import axios from "axios";
const instance = axios.create({
  baseURL: isDevEnv ? import.meta.env.VITE_API_URL : import.meta.env.VITE_TARGET,
  timeout: 1000 * 60 * 10,
  headers: {
    "Content-Type": "application/json",
  },
});
instance.interceptors.request.use(
  (config) => {
    config.params = filterParams(config.params);
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);
instance.interceptors.response.use(
  (response) => {
    return response.data;
  },
  (error) => {
    return Promise.reject(error);
  }
);

instance.defaults.headers.common["Content-Type"] = "application/json";
export default instance;
